POV-Ray : Newsgroups : povray.advanced-users : Volume-preserving blob : Re: Volume-preserving blob Server Time
29 Jul 2024 12:19:00 EDT (-0400)
  Re: Volume-preserving blob  
From: John Williamson
Date: 13 Oct 2002 12:14:01
Message: <3DA99C87.2980A601@dcs.gla.ac.uk>
Hi,

> 
> That only applies to a single component. When you have multiple
> components with different radii and strengths, the gradient doesn't have
> a limit.

That's true, but I think the gradient can be easily _evaluated_ at any
point even 
in a mixture, so it may still be of help (i.e we don't have to
approximate
the gradient numerically -- doesn't the current iso code need to do
something
like this?)
 
> Hmm...the function using exp() is unbounded, isn't it? 

Yep.

> In addition to
> the root solving possibly being slower from the use of exp(), each
> component would affect every other component in the blob. With a bounded
> function, one that is only used in a certain distance, you only need to
> compute for the components that affect a ray, which could speed things
> up.

That's a real problem with using exp, although the influence is
effectively bounded 
since the drop-off is pretty sharp -- cutting off after n standard
deviations from the 
center is an option. 
 
> Ken Perlin recently updated his perlin noise algorithm with a new
> polynomial S-curve function that eliminated second-derivative
> discontinuities, maybe that could be of some use as a bounded function...

Do you have any details of this? Sounds quite interesting...
 
> > Mind you, just testing Gaussian blob iso's with the above function just
> > now, it seems that they can be quite difficult to control. Still, they
> > seem smooth.
> 
> I haven't had a chance to do any experiments, what makes them more
> difficult?

Mainly the problem above; every component has an effect on the whole
thing, 
and it can be quite dramatic. So I found that the blob had a tendency to
dramatically change shape with fairly small adjustments in the
parameters. But I'm not very expert at 
manipulating blobs, so that might be a problem!

I've appended the scene I'm using for testing below...

--John



#version 3.5;

#include "colors.inc"
#include "functions.inc"

global_settings {assumed_gamma 1.0}

camera {
  location  <0.0, 0.1, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.5,  0.0>
}

sky_sphere {
  pigment {
    gradient y 
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  0*x          
  color rgb <1, 1, 0.6>  
  translate <-30, 30, -30>
}

#declare fn_gauss = function(x,y,z,r) { 1.0 - exp(-(x*x + z*z + y*y) /
r) }  

#declare fn_blob = function(x,y,z) { 
(fn_gauss(x,y,z,0.7) + fn_gauss(x+1, y+1, z, 0.7)  +
fn_gauss(x-1,y,z,0.7) + fn_gauss(x, y+2, z, 0.7) +
fn_gauss(x-0.3,y+0.3,z-1,0.7)+fn_gauss(x,y,z,0.1)) / 7.5  }  //Six
component blob

isosurface {
  function { fn_blob(x, y, z)  }        
  contained_by { box { -4.0, 4.0 } }  
  threshold 0.75
  accuracy 0.01                      
  max_gradient 1                      
  scale 0.3  
  translate 1*y
  texture
  {
   pigment { color rgbt <1.0, 1.0, 1.0> }
   finish
   {
     ambient 0
     diffuse 0.8
   }
  }
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.